#ifndef TCPSERVER_H
#define TCPSERVER_H

#include <QTcpServer>
#include <QTcpSocket>
#include <QDebug>

class TcpServer : public QTcpServer
{
    Q_OBJECT
public:
    /*
    static TcpServer *get()
    {
        static TcpServer t;
        return &t;
    }*/

    TcpServer(QObject *parent = nullptr);

    void startServer(int port);

    QTcpSocket *clientSocket = NULL;

    void sendData(QString data);
    void sendData(char *data, quint64);
signals:
    void sigRecv(QString data);

private slots:
    void onNewConnection();
};

#endif // TCPSERVER_H
